<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8" isELIgnored="false"%>
<%@ include file="/WEB-INF/common/head.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8">
		<title>用户管理</title>
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<script type="text/javascript" src="${resource }/js/jquery-2.1.1.min.js"></script>
		<link rel="stylesheet" href="${resource }/css/bootstrap.css" />
		<link rel="stylesheet" href="${resource }/css/iconfont.css" />
	</head>

	<body>
		<div class="row wrapper border-bottom white-bg page-heading">
			<div class="col-sm-4">
				<h2>公告</h2>
				<ol class="breadcrumb">
					<li>
						<a href="index.html">主页</a>
					</li>
					<li>
						<strong>用户管理</strong>
					</li>
				</ol>
			</div>
		</div>
		<div class="row wrapper border-bottom white-bg page-heading">
			<div class="col-md-12">
				<!-- 用户列表--bootstrap高级表格使用 -->
				<div class="panel panel-default">
					<div class="panel-heading"> 用户列表
					</div>
					<div class="panel-body">
						<!--table-responsive响应式表格，会自动添加滚动条-->
						<div class="table-responsive">
							<div style="float:right">
								<a href="addshow.do"><input class="btn btn-success" id="add" style="background: #286090;" type="button" value="添加用户"></a>
							</div>
							<form method="post" action="show.do" id="myform">
								<div class="col-sm-5" id="so" style="float:left">
									<div class="input-group">
										<input type="text" class="form-control"name="userName"value="${user.userName }" onkeydown="onKeyDown(event)" placeholder="请输入用户名搜索"/>
										<span class="input-group-addon">
											<a href="javascript:void(0)" onclick="submit()" style="text-decoration:none;">
											<i class="iconfont icon-search"> <span >搜索   </span></i></a>
										</span>
									</div>
								</div>
							</form>
							<table class="table">
								<thead>
									<tr>
										<th>用户编号</th>
										<th>姓名</th>
										<th>账号</th>
										<th>部门</th>
										<th>角色</th>
										<th>联系方式</th>
										<th>状态</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${users}" var="user">
										<tr class="even gradeC">
											<td>${user.id }</td>
											<td>${user.userName }</td>
											<td>${user.userAccount }</td>
											<td>${user.depart }</td>
											<td class="center">${user.role }</td>
											<td class="center">${user.userTel }</td>
											<c:if test="${user.userState==1}">
												<td class="center">可用</td>
											</c:if>
											<c:if test="${user.userState==0}">
												<td class="center">停用</td>
											</c:if>
											<td>
												<a href="update.do?id=${user.id} " style="color:darkblue"> <i class="iconfont icon-shuru"></i>编辑 </a>
											<a></a>
											<a href="delete.do?id=${user.id}" name="del" id="1" style="color:darkblue">  <i class="iconfont icon-shanchu"></i> 删除
												</a>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>

						<!--分页显示-->
						<div class="row">
							<div class="col-md-6">
								<div class="pagination" style="margin: 0px;" role="alert" aria-live="polite" aria-relevant="all">显示 1 到 ${user.getPages()} 页 记录数${user.getTotal()}</div>
							</div>
							<!-- 动态分页 -->
							<div class="row">
							<div id="page" class="col-md-6" style="text-align: right;float:right;" ></div>
							</div>
						</div>
						<!--分页显示-->
					</div>
				</div>
				<!--表格结束 -->
			</div>
		</div>

		<!-- Mainly scripts -->
		<script src="${resource }/js/jquery-2.1.1.min.js"></script>
		<script src="${resource }/js/bootstrap.min.js?v=3.4.0"></script>
		<!-- 分页插件，依赖于jquery位于jquery之后 -->
		<script src="${resource }/js/page.js"></script>
	</body>
	<script>
		function flow_detail(x) {
			alert(x);
			window.location.href = "";
		}
	</script>
	<script>
	function submit(){
		var form=document.getElementById('myform');
		form.submit();
	}
	$(function(){
			/* 分页插件使用 */
			$("#page").page({/* #page是分页条div的id，调用分页插件page.js中封装的page函数*/
				pageNo:${user.getPageNo()},/*向page函数传  当前页数，当前页数从controller获取*/
				totalPage:${user.getPages()},/*向page函数传  总页数，总页数从controller获取*/
				url:"${user.getUrl()}",/*向page函数传  处理分页的controller地址*/
				params:"${user.getParams()}"
			});
		}) 
	</script>

</html>